package cn.iocoder.yudao.module.promotion.dal.mysql.interviewlog;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.promotion.controller.admin.interviewlog.vo.InterviewLogExportReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.interviewlog.vo.InterviewLogPageReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.interviewlog.InterviewLogDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * url访问记录 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface InterviewLogMapper extends BaseMapperX<InterviewLogDO> {

    default PageResult<InterviewLogDO> selectPage(InterviewLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InterviewLogDO>()
                .eqIfPresent(InterviewLogDO::getUserId, reqVO.getUserId())
                .eqIfPresent(InterviewLogDO::getUrlId, reqVO.getUrlId())
                .eqIfPresent(InterviewLogDO::getUrl, reqVO.getUrl())
                .eqIfPresent(InterviewLogDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(InterviewLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InterviewLogDO::getId));
    }

    default List<InterviewLogDO> selectList(InterviewLogExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InterviewLogDO>()
                .eqIfPresent(InterviewLogDO::getUserId, reqVO.getUserId())
                .eqIfPresent(InterviewLogDO::getUrlId, reqVO.getUrlId())
                .eqIfPresent(InterviewLogDO::getUrl, reqVO.getUrl())
                .eqIfPresent(InterviewLogDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(InterviewLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InterviewLogDO::getId));
    }

}
